<script setup>
   import {ref, onMounted} from 'vue'
   import {useRouter} from 'vue-router'

   //获取用户名
   let account  = ref('');
   onMounted(()=>{
     account.value = window.localStorage.getItem("user");
   })

   let router = useRouter();
   //退出登录方法
   let logout = ()=>{
     window.localStorage.removeItem("user");
     router.push("/login");
   }
</script>

<template>
  <div>

    登录账号为： {{ account }} <br>
    <button @click="logout()">退出登录 </button>

  </div>
</template>

<style scoped>

</style>